package org.code.mallspringboot.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.code.mallspringboot.pojo.*;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

/**
 * @author jamie
 */
@Mapper
public interface UmsAdminMapper {

    long countByExample(UmsAdminExample example);

    int deleteByExample(UmsAdminExample example);

    int deleteByPrimaryKey(Long id);

    int insert(UmsAdmin row);

    int insertSelective(UmsAdmin row);

    /**
     * 根据条件查询用户列表
     * @param example
     * @return
     */
    List<UmsAdmin> selectByExample(UmsAdminExample example);

    /**
     * 根据主键查询用户
     * @param id
     * @return
     */
    UmsAdmin selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("row") UmsAdmin row, @Param("example") UmsAdminExample example);

    int updateByExample(@Param("row") UmsAdmin row, @Param("example") UmsAdminExample example);

    /**
     * 根据主键更新用户信息
     * @param row
     * @return
     */
    int updateByPrimaryKeySelective(UmsAdmin row);

    int updateByPrimaryKey(UmsAdmin row);

    /**
     * 根据用户名查询用户
     * @param userName
     * @return
     */
    @Cacheable(value = "umsAdmin", key = "#userName")
    List<UmsAdmin> selectByUserName(String userName);

}
